package cn.com.czpb.client.module.newsnew.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.com.czpb.client.R;
import cn.com.czpb.client.model.news.NewsBean;
import cn.com.czpb.client.model.newsnew.NewsNewListBean;

/**
 * Created by Administrator on 2018/6/27.
 */

public class NewsAdapter extends BaseQuickAdapter<NewsBean,BaseViewHolder>{
    private int type;
    public NewsAdapter( @Nullable List<NewsBean> data,int type) {
        super(R.layout.item_live_list, data);
        this.type=type;
    }

    @Override
    protected void convert(BaseViewHolder helper, NewsBean item) {
        helper.addOnClickListener(R.id.item);
        helper.setText(R.id.tv_title,item.getTitle());
        Glide.with(mContext).load(item.getImgs().get(0)).into((ImageView) helper.getView(R.id.iv_img));
        if (type==1){
            helper.setText(R.id.tv_copyfrom,"来自"+item.getCopyfrom());
            Glide.with(mContext).load(item.getBigimg()).into((ImageView) helper.getView(R.id.iv_icon));
        }
    }
}
